package com.sino.operation.service.business;

import com.sino.operation.dto.Dto;
import com.sino.operation.dto.inner.TaskQueue;
import com.sino.operation.param.inner.TaskQueueParam;
import com.sino.operation.service.impl.BizTranslistServiceImpl;
import com.sino.operation.util.PaginateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Title: TaskQueueService
 * @Description: 任务队列查询服务
 * @Author dengls
 * @date 2021/10/27 15:28
 */
@Service
public class TaskQueueService {

    @Autowired
    private BizTranslistServiceImpl transListService;

    public Dto getTaskQueueList(TaskQueueParam taskQueueParam) {
        String taskNo = taskQueueParam.getTaskNo();
        String startTime = taskQueueParam.getStartTime();
        String endTime = taskQueueParam.getEndTime();
        String taskStatus = taskQueueParam.getTaskStatus();
        String transType = taskQueueParam.getTransType();
        String tellerCode = taskQueueParam.getTellerCode();
        String centerNo = taskQueueParam.getCenterNo();
        Integer pageIndex = taskQueueParam.getPage();//页数
        Integer pageSize = taskQueueParam.getPageSize();//条数
        int count = transListService.getTransListForNetHandleCount(tellerCode, taskNo, startTime, endTime, taskStatus, transType, centerNo);
        Dto dto = new Dto();
        if (count > 0) {
            List<TaskQueue> allTaskQueues = transListService.getTransListForNetHandleList(tellerCode, taskNo, startTime, endTime, taskStatus, transType, centerNo);
            List<TaskQueue> taskQueues = PaginateUtil.execute(allTaskQueues, pageIndex, pageSize, count);
            dto.setCount(count);
            dto.setData(taskQueues);
        }
        return dto;
    }
}
